All Questions
16 questions
3votes
1answer
696views
Optimizing code solution for Palindrome Index-Hackerrank
I submitted my solution for palindrome Index coding challenge but I get "test cases terminated due to time out error". My code is working and so I don't know what else to do to optimize it. Please ...
1vote
1answer
248views
Palindrome Pairs
The task is taken from leetcode Given a list of unique words, find all pairs of distinct indices (i, j) in the given list, so that the concatenation of the two words, i.e. words[i] + words[j] ...
5votes
3answers
2kviews
Determine whether an integer is a palindrome
The task Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward. Example 1: Input: 121 Output: true Example 2: ...
4votes
1answer
245views
Return whether a string is a palindrome if you can delete at most k elements
The task: Given a string which we can delete at most k, return whether you can make a palindrome. For example, given 'waterrfetawx' and a k of 2, you could delete f and x to get 'waterretaw'...
11votes
5answers
1kviews
Easy to read palindrome checker
I made a palindrome checker that's supposed to be designed to be simple and easy to read. Please let me know what you think. I believe the time complexity is \$\mathcal{O}(n)\$ but I'm not too sure ...
2votes
1answer
293views
Find palindromes in circular rotated string
I'm trying to tackle a programming challenge to determine how many palindromes exist in a given string that is being rotated character by character. My solution works, but it's too slow, and I'm ...
3votes
2answers
185views
Code Chef RAINBOW Palindrome
Problem Determine whether an array is "Rainbow", i.e. it has the following structure: First a1 elements equal 1. Next a2 elements equal 2. Next a3 elements equal 3. Next a4 elements ...
8votes
3answers
2kviews
Leetcode 125. Valid Palindrome (better performance?)
Problem statement Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases. For example, "A man, a plan, a canal: Panama" is a ...
4votes
1answer
613views
Leetcode 125. Valid Palindrome
Problem statement Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases. For example, "A man, a plan, a canal: Panama" is a ...
4votes
2answers
11kviews
Reverse digits and add until a palindrome appears
The following code is a C solution to the following problem UVA 10018. The Problem The "reverse and add" method is simple: choose a number, reverse its digits and add it to the original. If ...
8votes
3answers
6kviews
Project Euler #4 - Largest Palindrome Product in Java
I am seeing that this is actually not in accord with the difficulty level said there. Firstly I cannot list all possible improvements it could have. ...
4votes
2answers
369views
Largest palindrome in a string
I am working on a question in which I need to find a largest palindrome given a string. Here is the description. ...
3votes
6answers
7kviews
Largest palindrome made from the product of two 3-digit numbers
I am working on an interview question in which I need to find the largest palindrome made from the product of two 3-digit numbers. Here is the question. ...
5votes
2answers
2kviews
Minimum number of letters removed, to make a string Peragram
Here is the link to the problem Peragrams. Peragrams: If a word is an anagram of at least one palindrome, we call it a Peragram. Problem: Given a string, find the minimum number of letters you ...
3votes
2answers
553views
"Longest Palindromic Substring" challenge solution is inefficient
I am trying to solve the Longest Palindromic Substring problem on LeetCode, and I have come up with a DP solution pasted below: ...